var is_loading = !1;

Page({
  data: {
    order_id: null,
    order_type: null,
    order_info: [],
    latitude: '',
    longitude: '',
    hide: 1,
    qrcode: ''
  },
  onLoad: function (t) {
    getApp().page.onLoad(this, t);
    if (!t.order_id && t.scene) {
      var s = decodeURIComponent(t.scene);
      if (void 0 !== s) {
        var a = utils.scene_decode(s);
        this.setData({
          order_id: a.order_id,
          order_type: a.order_type
        });
        a.order_id && (this.wancheng(a.order_id));
        return;
      }
    }
    this.setData({
      order_id: t.order_id,
      order_type: t.order_type
    });
    console.log(this.data.order_id);
    this.getLocation()
  },
  loadData: function () {
    let o = this;
    console.log(o.data);
    getApp().core.showLoading()
    getApp().request({
      url: getApp().api.order.de_detail,
      data: {
        order_id: o.data.order_id,
        delivery_type: o.data.order_type,
        latitude: o.data.latitude,
        longitude: o.data.longitude
      },
      method: "get",
      success: function (a) {
        getApp().core.hideLoading()
        if (0 == a.code) {
          o.setData({
            order_info: a.data
          });
          console.log(o.data.order_info)
        } else getApp().core.showToast({
          title: a.msg,
          icon: 'none'
        });
      },
      fale: function (t) {
        getApp().core.hideLoading()
      }
    });
  },
  goLocation:function(a){
    console.log(a);
    var o = this,
    longitude = a.currentTarget.dataset.longitude,latitude = a.currentTarget.dataset.latitude,address = a.currentTarget.dataset.address;
    console.log(parseFloat(longitude));
    wx.getLocation({
      type: 'wgs84', 
      success: function (res) {
        wx.openLocation({//​使用微信内置地图查看位置。
          latitude: parseFloat(latitude),//要去的纬度-地址
          longitude: parseFloat(longitude),//要去的经度-地址
          scale: 18,
          address: address
        })
      }
    })
  },
  getLocation: function () {
    let o = this;
    wx.getLocation({
      type: 'wgs84',
      success: (res) => {
        o.setData({
          latitude: res.latitude,
          longitude: res.longitude
        });
      },
      complete:function(){
        o.loadData();
      }

    })
  },
  telShop: function (e) {
    console.log(e);
    var phone = e.currentTarget.dataset.phone;
    if (phone) {
      wx.makePhoneCall({
        phoneNumber: phone
      })
    } else {
      getApp().core.showModal({
        title: "拨打失败",
        content: "商家未绑定手机号",
        showCancel: !1
      });
    }
    console.log(e);
  },
})
